// 组织架构
import request from '@/utils/request'

/**
 * 获取组织架构数据
 */
export function getDepartments () {
  return request({
    url: '/company/department',
    method: 'get'
  })
}

/**
 * 删除组织架构的部门
 */
export function delDepartments (id) {
  return request({
    url: `/company/department/${id}`,
    method: 'DELETE'
  })
}

/**
 * 添加组织架构的部门
 */
export function addDepartments (data) {
  return request({
    url: '/company/department', // rstful接口规范, 接口相同,请求不同
    method: 'post',
    data
  })
}

/**
 * 获取员工简单列表
 * 只有 id username
 */
export function getEmployeeSimple () {
  return request({
    url: '/sys/user/simple',
    method: 'get'
  })
}

/**
 * 获取部门详情
 */
export function getDepartDetail (id) {
  return request({
    url: `/company/department/${id}`,
    method: 'get'
  })
}

/**
 * 根据ID修改部门详情
 */
export function updateDepartments (data) {
  return request({
    url: `/company/department/${data.id}`,
    method: 'put',
    data
  })
}
